from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select

driver = webdriver.Chrome()
driver.get('http://192.168.20.244/ecshop/admin/privilege.php?act=login')
driver.maximize_window()

driver.find_element(By.NAME,'username').send_keys('caichang')
driver.find_element(By.NAME,'password').send_keys('caichang1')
driver.find_element(By.CLASS_NAME,'btn-a').click()

driver.switch_to.frame('menu-frame') # 进入内帧
driver.find_element(By.LINK_TEXT,'商品列表').click()

driver.switch_to.default_content() # 退出内帧回到默认
driver.switch_to.frame('main-frame')

Select(driver.find_element(By.NAME,'intro_type')).select_by_visible_text('新品')

driver.find_element(By.NAME,'keyword').send_keys('N85')
driver.find_element(By.XPATH,'//input[@value=" 搜索 "]').click()
